In [1]:
import sys
sys.path.append('../src')

import trimesh

from organ import Organ
from tissue import TissueBlock
from pipeline import Pipeline
In [2]:
source = Organ(path='../data/3d-vh-m-kidney-l.glb')
target = Organ(path='../data/3d-vh-m-kidney-r.glb')
In [3]:
source.show()
Out[3]:
In [4]:
target.show()
Out[4]:
In [5]:
# instantiate the registration pipeline
pipeline = Pipeline(name='Kidney Registration', description='Projecting the Male Left kidney to Male Right Kidney', params='../configs/params.yaml')
In [6]:
pipeline.params
Out[6]:
{'nonrigid_registration': {'autotune': 'False',
  'gamma': 10,
  'beta': 2,
  'decimation': 'False',
  'distance_threshold': '1e-8',
  'lambda': 10,
  'downsampling': 'Y, 26443, 0.05',
  'max_iterations': 1000,
  'seed': 26},
 'rigid_registration': {'global_distance_threshold_factor': 0.23,
  'global_edge_length_threshold_factor': 0.95,
  'global_max_correspondence': 0.999,
  'global_max_iterations': 100000,
  'max_nn': 100,
  'refine_distance_threshold_factor': 0.1,
  'voxel_size': 0.025}}
In [7]:
# run registration
projections = pipeline.run(source=source, target=target)
In [8]:
 # display result
projections.registration.show()
Out[8]:

Export Projections - Reproducibility and Future Use¶

In [9]:
from dataclass import Projection
In [10]:
# export (remember to modify the save path)
projections.export(path='../projections/')
In [13]:
# load (remember to modify the load path for the pickle file)
projections = Projection.load(path='../projections/-af981447-fc9a-45c9-a15c-c44dba35740f/projections.pickle')
In [ ]:
# helper code to convert notebook to html
!jupyter nbconvert --to html Usage.ipynb